package com.jeedlelabs.tubess;

import java.util.ArrayList;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.GridView;


public class MainActivity extends Activity {

	 private ArrayList<Item> gridArray = new ArrayList<Item>();
	 private VideoGridViewAdapter customGridAdapter;
	 private ImageDownloader downloader;
     private String [] urls = new String [10];
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		urls[0] = "http://i.ytimg.com/vi/OpQFFLBMEPI/mqdefault.jpg";
        urls[1] = "http://i.ytimg.com/vi/Ahha3Cqe_fk/mqdefault.jpg";
        urls[2] = "http://i.ytimg.com/vi/5y_KJAg8bHI/mqdefault.jpg"; 
        urls[3] = "http://i.ytimg.com/vi/PVzljDmoPVs/mqdefault.jpg";
        urls[4] = "http://i.ytimg.com/vi/ekzHIouo8Q4/mqdefault.jpg";
        urls[5] = "http://i.ytimg.com/vi/QK8mJJJvaes/mqdefault.jpg";
        urls[6] = "http://i.ytimg.com/vi/AJVpL6L7Zeo/mqdefault.jpg";
        urls[7] = "http://i.ytimg.com/vi/mO1QBTG6EXs/mqdefault.jpg";
        urls[8] = "http://i.ytimg.com/vi/rYEDA3JcQqw/mqdefault.jpg";
        urls[9] = "http://i.ytimg.com/vi/hLQl3WQQoQ0/mqdefault.jpg";
      
		
		GridView videos = (GridView) findViewById(R.id.videoGrid);
		customGridAdapter = new VideoGridViewAdapter(this, R.layout.row_grid, gridArray);
		downloader = new ImageDownloader(customGridAdapter, gridArray);
		downloader.execute(urls);

		videos.setAdapter(customGridAdapter);		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
}
